/**
 * 版权所有：厦门市巨龙信息科技有限公司
 * Copyright 2023 Xiamen Dragoninfo Eng. Co. Ltd.
 * All right reserved.
 */
package com.github.alfred.exception;


import com.github.alfred.enums.IErrorCodeEnum;

/**
 * 类说明
 *
 * @author chengh
 * @date 2023/5/22 21:41
 */
public class ExceptionFactory {

    private ExceptionFactory() {

    }

    public static BizException bizException(String errorMessage) {
        return new BizException(errorMessage);
    }

    public static BizException bizException(String errorCode, String errorMessage) {
        return new BizException(errorCode, errorMessage);
    }

    public static BizException bizException(IErrorCodeEnum errorCodeEnum) {
        return new BizException(errorCodeEnum);
    }

    public static BizException bizException(IErrorCodeEnum errorCodeEnum, Throwable throwable) {
        return new BizException(errorCodeEnum.getErrorCode(), errorCodeEnum.getErrorMsg(), throwable);
    }


    public static BizException bizException(String errorMessage, Throwable throwable) {
        return new BizException(errorMessage, throwable);
    }

    public static BizException bizException(IErrorCodeEnum errorCodeEnum, Object... args) {
        return new BizException(errorCodeEnum, args);
    }

    public static SysException sysException(String errorMessage) {
        return new SysException(errorMessage);
    }

    public static SysException sysException(String errorCode, String errorMessage) {
        return new SysException(errorCode, errorMessage);
    }


    public static SysException sysException(String errorMessage, Throwable e) {
        return new SysException(errorMessage, e);
    }

    public static SysException sysException(String errorCode, String errorMessage, Throwable e) {
        return new SysException(errorCode, errorMessage, e);
    }

}
